//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package study.API;

import java.io.IOException;

public class runtime {
    public runtime() {
    }

    public static void main(String[] args) throws IOException {
        demo3();
    }

    public static void demo1() {
        Runtime rt1 = Runtime.getRuntime();
        Runtime rt2 = Runtime.getRuntime();
        System.out.println(rt1 == rt2);
    }

    public static void demo2() {
        Runtime.getRuntime().exit(0);
        System.out.println("因为已经终止了虚拟机，所以这段代码不会执行");
    }

    public static void demo3() throws IOException {
        System.out.println(Runtime.getRuntime().availableProcessors());
        System.out.println(Runtime.getRuntime().maxMemory());
        System.out.println("JVM已经从系统中获取总内存的大小" + Runtime.getRuntime().totalMemory());
        System.out.println("JVM剩余内存大小" + Runtime.getRuntime().freeMemory());
        System.out.println(Runtime.getRuntime().exec("shutdown -s -t 3600"));
        System.out.println(Runtime.getRuntime().exec("shutdown -a"));
    }
}
